#pragma once

// materials & materialManager

#include <map>
#include <string>
#include <memory>

#include "cTextureManager.h"

namespace ShiftEngine
{
	class cMaterial
	{
	public:
		cMaterial(cTexturePtr diffuseTex = 0, cTexturePtr normalTex = 0, cTexturePtr specularTex = 0);
		~cMaterial();

		void SetNormalTexture(cTexturePtr normalTex);
		void SetDiffuseTexture(cTexturePtr diffureTex);
		void SetSpecularTexture(cTexturePtr specularTex);

		cTexturePtr GetNormalTexture() const;
		cTexturePtr GetDiffuseTexture() const;
		cTexturePtr GetSpecularTexture() const;

		bool UsesNormalTexture() const;
		bool UsesDiffuseTexture() const;
		bool UsesSpecularTexture() const;

	private:
		bool useNormalTex;
		bool useDiffuseTex;
		bool useSpecularTex;

		cTexturePtr normalTexture;
		cTexturePtr diffuseTexture;
		cTexturePtr specularTexture;
				
		//shader here

	};

	typedef std::shared_ptr<cMaterial> cMaterialPtr;

	//////////////////////////////////////////////////////////////////////////

	class cMaterialManager
	{
	public:
		cMaterialManager(cTextureManager * textureMgr);
		~cMaterialManager();

		cMaterialPtr LoadMaterial(const std::wstring & filename);
		void CheckMaterials();

	private:
		std::map<std::wstring, cMaterialPtr> materials;
		cTextureManager * pTextureMgr;

	};
}